package org.desktop.web.shared.domain.entities;

import java.io.Serializable;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Date;


/**
 * The persistent class for the USERS_LOGGED database table.
 * 
 */
@Entity
@Table(name="USERS_LOGGED")
@NamedQuery(name="UsersLogged.findAll", query="SELECT u FROM UsersLogged u")
@JsonAutoDetect(fieldVisibility=Visibility.ANY)
@JsonInclude(Include.NON_NULL)
public class UsersLogged implements Serializable, com.google.gwt.user.client.rpc.IsSerializable {
	private static final long serialVersionUID = 1L;
	private String id;
	private Date lastAccess;
	private String lastRequest;
	private String referer;
	private String sessioId;
	private String token;
	
	@JsonProperty("idUser")
	private User user;

	public UsersLogged() {
	}


	@Id
	@Column(unique=true, nullable=false, length=100)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}


	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="LAST_ACCESS", nullable=false)
	public Date getLastAccess() {
		return this.lastAccess;
	}

	public void setLastAccess(Date lastAccess) {
		this.lastAccess = lastAccess;
	}


	@Column(name="LAST_REQUEST", length=500)
	public String getLastRequest() {
		return this.lastRequest;
	}

	public void setLastRequest(String lastRequest) {
		this.lastRequest = lastRequest;
	}


	@Column(length=45)
	public String getReferer() {
		return this.referer;
	}

	public void setReferer(String referer) {
		this.referer = referer;
	}


	@Column(name="SESSIO_ID", nullable=false, length=200)
	public String getSessioId() {
		return this.sessioId;
	}

	public void setSessioId(String sessioId) {
		this.sessioId = sessioId;
	}


	@Column(nullable=false, length=200)
	public String getToken() {
		return this.token;
	}

	public void setToken(String token) {
		this.token = token;
	}


	//bi-directional many-to-one association to User
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ID_USER", nullable=false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}